-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Scale and length handling in CASE
and JOIN bind variables
#15787
Conversation
Signed-off-by: Manan Gupta <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15787 +/- ##
==========================================
- Coverage 68.44% 68.43% -0.01%
==========================================
Files 1558 1558
Lines 195822 195885 +63
==========================================
+ Hits 134025 134049 +24
- Misses 61797 61836 +39 ☔ View full report in Codecov by Sentry. |
else 0 | ||
end) * 0.01`, | ||
result: `DECIMAL(0.0001)`, | ||
typeWanted: evalengine.NewTypeEx(sqltypes.Decimal, collations.CollationBinaryID, false, 4, 4), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to merge / rebase since the signature of this function has changed.
@@ -691,6 +692,8 @@ func (cs *CaseExpr) compile(c *compiler) (ctype, error) { | |||
} | |||
|
|||
ta.add(then.Type, then.Flag) | |||
scale = max(scale, then.Scale) | |||
size = max(size, then.Size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this logic apply to other usages of the typeAggregation
as well? And should this really be part of typeAggregation
therefore instead? Seems like that might be more appropriate to refactor it into that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the required changes. I wasn't sure what the length and scale for other data types looks like, so I just passed 0 from everywhere.
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Dirkjan Bussink <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Description
This PR fixes a part of the problem described in #15784 (comment).
This PR fixes 2 issues -
scale
andlength
for decimal incase
implementation of evalengine.JOIN
engine primitive for DECIMAL type, taking thescale
andlength
into account.Related Issue(s)
Checklist
Deployment Notes